package jou.cs.controller;

import jou.cs.service.QuestionService;
import jou.cs.service.UserService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("user")
public class user {
    @Resource
    private UserService service;
    @Resource
    private QuestionService questionService;

    @GetMapping("{id}")
    public Object getUserById(@PathVariable Long id) {
        return service.getUserById(id);
    }

    @GetMapping
    public Object gg(@RequestParam Long uid) {
        return questionService.getQuestionByUserId(uid);
    }

    @PostMapping
    public Object loign(@RequestParam String username, @RequestParam String password) {
        return service.login(username, password);
    }
}
